<template>
  <a-modal
    :width="1400"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleSubmit"
    @cancel="handleCancel"
    cancelText="关闭"
  >
    <a-tabs>
      <a-tab-pane
              loading="true"
              tab="资产详情"
              :key="formInfo.id+1">
    <a-descriptions :title="formInfo.title">
      <a-descriptions-item label="名称">{{ formInfo.name }}</a-descriptions-item>
      <a-descriptions-item label="类型">{{ formInfo.equTypeName }}</a-descriptions-item>
      <a-descriptions-item label="设备小类">{{ formInfo.equType1 }}</a-descriptions-item>
      <a-descriptions-item label="设备编码">{{ formInfo.equNo }}</a-descriptions-item>
      <a-descriptions-item label="品牌">{{ formInfo.brand }}</a-descriptions-item>
      <a-descriptions-item label="型号">{{ formInfo.quality }}</a-descriptions-item>
      <a-descriptions-item label="资产原值">{{ formInfo.equValue }}</a-descriptions-item>
      <a-descriptions-item label="所在位置" :span="2">
        {{formInfo.campusAddress}}
        <span v-if="formInfo.buildings">/{{formInfo.buildings}}</span>
        <span v-if="formInfo.floors">/{{formInfo.floors}}</span>
        <span v-if="formInfo.rooms">/{{formInfo.rooms}}</span>
        {{ formInfo.address }}
      </a-descriptions-item>
      <a-descriptions-item label="生产厂商">{{ formInfo.factory }}</a-descriptions-item>
      <a-descriptions-item label="出厂时间">{{ formInfo.scDate }}</a-descriptions-item>
      <a-descriptions-item label="启用日期">{{ formInfo.anzDate }}</a-descriptions-item>
      <a-descriptions-item label="验收日期">{{ formInfo.yansDate }}</a-descriptions-item>
      <a-descriptions-item label="使用时长">{{ formInfo.lifes }}{{ this.$sysDictFilter(formInfo.lifesUnit, 'timeunit') }}</a-descriptions-item>
      <a-descriptions-item label="保修状态">{{ this.$sysDictFilter(formInfo.repFlag, 'repFlag') }}</a-descriptions-item>
      <a-descriptions-item label="保修到期日期">{{ formInfo.repDate }}</a-descriptions-item>
      <a-descriptions-item label="实物ID编码">{{ formInfo.equNumber }}</a-descriptions-item>
      <a-descriptions-item label="是否贴签">{{ formInfo.isFlag }}</a-descriptions-item>
      <a-descriptions-item label="房产类型">{{ formInfo.roomType }}</a-descriptions-item>
      <a-descriptions-item label="状态">{{ formInfo.useState }}</a-descriptions-item>

    </a-descriptions>
      </a-tab-pane>
      <a-tab-pane
              loading="true"
              tab="维修明细"
              :key="formInfo.id+2">
        <equ-repair-deail-list :equipid="formInfo.id"></equ-repair-deail-list>

      </a-tab-pane>
    </a-tabs>
  </a-modal>
</template>

<script>
  import pick from 'lodash.pick'
  import { getAction } from '@/api/manage'
  import EquRepairDeailList from "../equRepairDeail/EquRepairDeailList";

  export default {
    name: 'EquEquipmentView',
    components: {EquRepairDeailList},
    data () {
      return {
        visible: false,
        confirmLoading: false,
        formInfo: {},
        url: {
          saveInfo: '/system/equEquipment/save',
          getInfo: '/system/equEquipment/info'
        }
      }
    },
    created () {
    },
    methods: {
      show (record) {
        this.formInfo = Object.assign({}, record)

        this.visible = true
      },
                                                                                                                                                                                                                                      // 确定
      handleSubmit () {
        this.visible = false
      },
      // 关闭
      handleCancel () {
        this.close()
      },
      close () {
        this.visible = false
      }
    }
  }
</script>
